cmake_minimum_required(VERSION 2.8.3)
project(g2o_vo)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -w")

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  roscpp
)
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)

find_package(Eigen3 REQUIRED)
find_package(Cholmod REQUIRED)

catkin_package(
 INCLUDE_DIRS include
 LIBRARIES g2o_vo
 CATKIN_DEPENDS roscpp
#  DEPENDS system_lib
)

###########
## Build ##
###########
# set(G2O_CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER}")
configure_file(config.h.in ${PROJECT_SOURCE_DIR}/config.h)
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
include
  ${EIGEN3_INCLUDE_DIR}

  ${catkin_INCLUDE_DIRS}
)
add_library(g2o_vo 
#types
${PROJECT_SOURCE_DIR}/src/g2o/types/types_sba.h
${PROJECT_SOURCE_DIR}/src/g2o/types/types_six_dof_expmap.h
${PROJECT_SOURCE_DIR}/src/g2o/types/types_sba.cpp
${PROJECT_SOURCE_DIR}/src/g2o/types/types_six_dof_expmap.cpp
${PROJECT_SOURCE_DIR}/src/g2o/types/types_seven_dof_expmap.cpp
${PROJECT_SOURCE_DIR}/src/g2o/types/types_seven_dof_expmap.h
${PROJECT_SOURCE_DIR}/src/g2o/types/se3quat.h
${PROJECT_SOURCE_DIR}/src/g2o/types/se3_ops.h
${PROJECT_SOURCE_DIR}/src/g2o/types/se3_ops.hpp

${PROJECT_SOURCE_DIR}/src/g2o/core/base_edge.h
${PROJECT_SOURCE_DIR}/src/g2o/core/base_binary_edge.h
${PROJECT_SOURCE_DIR}/src/g2o/core/hyper_graph_action.cpp
${PROJECT_SOURCE_DIR}/src/g2o/core/base_binary_edge.hpp
${PROJECT_SOURCE_DIR}/src/g2o/core/hyper_graph_action.h
${PROJECT_SOURCE_DIR}/src/g2o/core/base_multi_edge.h           
${PROJECT_SOURCE_DIR}/src/g2o/core/hyper_graph.cpp
${PROJECT_SOURCE_DIR}/src/g2o/core/base_multi_edge.hpp         
${PROJECT_SOURCE_DIR}/src/g2o/core/hyper_graph.h
${PROJECT_SOURCE_DIR}/src/g2o/core/base_unary_edge.h          
${PROJECT_SOURCE_DIR}/src/g2o/core/linear_solver.h
${PROJECT_SOURCE_DIR}/src/g2o/core/base_unary_edge.hpp         
${PROJECT_SOURCE_DIR}/src/g2o/core/marginal_covariance_cholesky.cpp
${PROJECT_SOURCE_DIR}/src/g2o/core/base_vertex.h               
${PROJECT_SOURCE_DIR}/src/g2o/core/marginal_covariance_cholesky.h
${PROJECT_SOURCE_DIR}/src/g2o/core/base_vertex.hpp             
${PROJECT_SOURCE_DIR}/src/g2o/core/matrix_structure.cpp
${PROJECT_SOURCE_DIR}/src/g2o/core/batch_stats.cpp             
${PROJECT_SOURCE_DIR}/src/g2o/core/matrix_structure.h
${PROJECT_SOURCE_DIR}/src/g2o/core/batch_stats.h               
${PROJECT_SOURCE_DIR}/src/g2o/core/openmp_mutex.h
${PROJECT_SOURCE_DIR}/src/g2o/core/block_solver.h              
${PROJECT_SOURCE_DIR}/src/g2o/core/block_solver.hpp            
${PROJECT_SOURCE_DIR}/src/g2o/core/parameter.cpp               
${PROJECT_SOURCE_DIR}/src/g2o/core/parameter.h                 
${PROJECT_SOURCE_DIR}/src/g2o/core/cache.cpp                   
${PROJECT_SOURCE_DIR}/src/g2o/core/cache.h
${PROJECT_SOURCE_DIR}/src/g2o/core/optimizable_graph.cpp       
${PROJECT_SOURCE_DIR}/src/g2o/core/optimizable_graph.h         
${PROJECT_SOURCE_DIR}/src/g2o/core/solver.cpp                  
${PROJECT_SOURCE_DIR}/src/g2o/core/solver.h
${PROJECT_SOURCE_DIR}/src/g2o/core/creators.h                 
${PROJECT_SOURCE_DIR}/src/g2o/core/optimization_algorithm_factory.cpp
${PROJECT_SOURCE_DIR}/src/g2o/core/estimate_propagator.cpp     
${PROJECT_SOURCE_DIR}/src/g2o/core/optimization_algorithm_factory.h
${PROJECT_SOURCE_DIR}/src/g2o/core/estimate_propagator.h       
${PROJECT_SOURCE_DIR}/src/g2o/core/factory.cpp                 
${PROJECT_SOURCE_DIR}/src/g2o/core/optimization_algorithm_property.h
${PROJECT_SOURCE_DIR}/src/g2o/core/factory.h                   
${PROJECT_SOURCE_DIR}/src/g2o/core/sparse_block_matrix.h
${PROJECT_SOURCE_DIR}/src/g2o/core/sparse_optimizer.cpp  
${PROJECT_SOURCE_DIR}/src/g2o/core/sparse_block_matrix.hpp
${PROJECT_SOURCE_DIR}/src/g2o/core/sparse_optimizer.h
${PROJECT_SOURCE_DIR}/src/g2o/core/hyper_dijkstra.cpp 
${PROJECT_SOURCE_DIR}/src/g2o/core/hyper_dijkstra.h
${PROJECT_SOURCE_DIR}/src/g2o/core/parameter_container.cpp     
${PROJECT_SOURCE_DIR}/src/g2o/core/parameter_container.h
${PROJECT_SOURCE_DIR}/src/g2o/core/optimization_algorithm.cpp 
${PROJECT_SOURCE_DIR}/src/g2o/core/optimization_algorithm.h
${PROJECT_SOURCE_DIR}/src/g2o/core/optimization_algorithm_with_hessian.cpp 
${PROJECT_SOURCE_DIR}/src/g2o/core/optimization_algorithm_with_hessian.h
${PROJECT_SOURCE_DIR}/src/g2o/core/optimization_algorithm_levenberg.cpp 
${PROJECT_SOURCE_DIR}/src/g2o/core/optimization_algorithm_levenberg.h
${PROJECT_SOURCE_DIR}/src/g2o/core/jacobian_workspace.cpp 
${PROJECT_SOURCE_DIR}/src/g2o/core/jacobian_workspace.h
${PROJECT_SOURCE_DIR}/src/g2o/core/robust_kernel.cpp 
${PROJECT_SOURCE_DIR}/src/g2o/core/robust_kernel.h
${PROJECT_SOURCE_DIR}/src/g2o/core/robust_kernel_factory.cpp
${PROJECT_SOURCE_DIR}/src/g2o/core/robust_kernel_factory.h
${PROJECT_SOURCE_DIR}/src/g2o/core/robust_kernel_impl.cpp 
${PROJECT_SOURCE_DIR}/src/g2o/core/robust_kernel_impl.h
${PROJECT_SOURCE_DIR}/src/g2o/core/optimization_algorithm_gauss_newton.cpp 
${PROJECT_SOURCE_DIR}/src/g2o/core/optimization_algorithm_gauss_newton.h


${PROJECT_SOURCE_DIR}/src/g2o/stuff/string_tools.h
${PROJECT_SOURCE_DIR}/src/g2o/stuff/color_macros.h 
${PROJECT_SOURCE_DIR}/src/g2o/stuff/macros.h
${PROJECT_SOURCE_DIR}/src/g2o/stuff/timeutil.cpp
${PROJECT_SOURCE_DIR}/src/g2o/stuff/misc.h
${PROJECT_SOURCE_DIR}/src/g2o/stuff/timeutil.h
${PROJECT_SOURCE_DIR}/src/g2o/stuff/os_specific.c    
${PROJECT_SOURCE_DIR}/src/g2o/stuff/os_specific.h
${PROJECT_SOURCE_DIR}/src/g2o/stuff/string_tools.cpp
${PROJECT_SOURCE_DIR}/src/g2o/stuff/property.cpp       
${PROJECT_SOURCE_DIR}/src/g2o/stuff/property.h       


${PROJECT_SOURCE_DIR}/src/g2o/stuff/sparse_helper.cpp
${PROJECT_SOURCE_DIR}/src/g2o/stuff/sparse_helper.h
${PROJECT_SOURCE_DIR}/src/g2o/solvers/linear_solver_cholmod.h
${PROJECT_SOURCE_DIR}/src/g2o/solvers/linear_solver_eigen.h
${PROJECT_SOURCE_DIR}/src/g2o/solvers/linear_solver_dense.h

)
# target_link_libraries(g2o_vo
# ${BLAS_LIBRARIES}
# ${LAPACK_LIBRARIES}
# )